﻿Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Seuss.EnterpriseLibrary.DataAccess
Imports Seuss.EnterpriseLibrary.BusinessLogic
Imports System.Web
Imports System.Data

Partial Class Consulta_AL_InfoAcad_CA
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Response.Expires = -1
        Response.AddHeader("Pragma", "no-cache")
        Response.AddHeader("cache-control", "private")
        Response.CacheControl = "no-cache"
        Dim DivPrincipal As New StringBuilder

        If Not Page.IsPostBack Then

            '******** TIPO CURRICULAS ********
            Dim ldrtipo As New List(Of IDataReader)
            Using ObjPool As New PoolDbCommand()
                Dim ObjUsuario As New DAL_Kiosco(ObjPool.Database)
                ObjPool.AddDbCommand(ObjUsuario.Get_TipoCurricula_By_cPerCodigo(IdentityUser.UserCode), PoolDbCommand.PoolDbCommandResultType.Query)
                ObjPool.Pooling(Nothing, ldrtipo, True)
            End Using

            DivPrincipal.Append("<table width='100%' style='text-align:left;'>")

            While ldrtipo(0).Read
                DivPrincipal.Append("<tr><td style='font-size:13px;color:#000000; text-align:left;font-weight :bold'><img src='../Imagenes/Ok2.gif' /> " + ldrtipo(0).Item("cintDescripcion").ToString + "</td></tr><tr><td></td></tr>")

                '******** CURRICULAS ********
                Dim ldrcurricula As New List(Of IDataReader)
                Using ObjPool As New PoolDbCommand()
                    Dim ObjUsuario As New DAL_Kiosco(ObjPool.Database)
                    ObjPool.AddDbCommand(ObjUsuario.Get_Curriculas_By_cPerCodigo_nTipCur(IdentityUser.UserCode, ldrtipo(0).Item("nIntCodigo")), PoolDbCommand.PoolDbCommandResultType.Query)
                    ObjPool.Pooling(Nothing, ldrcurricula, True)
                End Using
                While ldrcurricula(0).Read
                    DivPrincipal.Append("<tr><td style='font-size:12px; padding-left:25px;'><img src='../Imagenes/Ok.gif' /> " + ldrcurricula(0).Item("curricula").ToString + "</td></tr>")

                    Dim ldrcursos As New List(Of IDataReader)
                    Dim TB As DataTable

                    Using ObjPool As New PoolDbCommand()
                        Dim ObjUsuario As New DAL_Kiosco(ObjPool.Database)
                        If ldrtipo(0).Item("nIntCodigo") = 1 Then
                            ObjPool.AddDbCommand(ObjUsuario.Get_CursosMatriculados_By_cPerCodigo_nCurcodigo_nTipCur(IdentityUser.UserCode, ldrtipo(0).Item("nIntCodigo"), ldrcurricula(0).Item("ncurcodigo")), PoolDbCommand.PoolDbCommandResultType.Query)
                        ElseIf ldrtipo(0).Item("nIntCodigo") = 80 Then
                            ObjPool.AddDbCommand(ObjUsuario.Get_CursosMatriculadosPDP_By_cPerCodigo_nCurcodigo_nTipCur(IdentityUser.UserCode, ldrtipo(0).Item("nIntCodigo"), ldrcurricula(0).Item("ncurcodigo")), PoolDbCommand.PoolDbCommandResultType.Query)
                        ElseIf ldrtipo(0).Item("nIntCodigo") = 3 Then
                            ObjPool.AddDbCommand(ObjUsuario.Get_CursosMatriculadosPostgrado_By_cPerCodigo_nCurcodigo_nTipCur(IdentityUser.UserCode, ldrtipo(0).Item("nIntCodigo"), ldrcurricula(0).Item("ncurcodigo")), PoolDbCommand.PoolDbCommandResultType.Query)
                        Else
                            ObjPool.AddDbCommand(ObjUsuario.Get_CursosMatriculadosExtra_By_cPerCodigo_nCurcodigo_nTipCur(IdentityUser.UserCode, ldrtipo(0).Item("nIntCodigo"), ldrcurricula(0).Item("ncurcodigo")), PoolDbCommand.PoolDbCommandResultType.Query)
                        End If
                        ObjPool.Pooling(Nothing, ldrcursos, True)
                        TB = Helper.LoadDataTable(ldrcursos(0))
                    End Using

                    If ldrcursos.Count <> 0 Then
                        If TB.Rows.Count <> 0 Then
                            DivPrincipal.Append("<tr><td class=""listview"" style='padding-left:25px;width:80%;text-align:center;'><ul>")
                            For Each fila In TB.Rows
                                DivPrincipal.Append("<li><a style='font-size:14px; Color:#255B7F;' href=AL_CursoActual.aspx?nCurGruCodigo=" + fila.Item("nCurGruCodigo").ToString + ">" + fila.Item("curso").ToString + "</a></li>")
                            Next
                            DivPrincipal.Append("</ul></td></tr>")
                        End If
                    End If
                End While
            End While
            Using Seguridad As New BLL_Administracion
                Seguridad.Set_Transaccion_Insert(Nothing, 100401, IdentityUser.UserCode, My.Request.UserHostAddress.ToString, CrearXMLTransaccion("Consulta Pagina Movil", "/Pagina|" + My.Request.Url.Segments(My.Request.Url.Segments.Length - 1).ToString))
            End Using
        End If
        DivPrincipal.Append("</table>")
        lblcurricula.Text = DivPrincipal.ToString
    End Sub

End Class